To install:

devtools::install_github("dtm2451/dittoSeq")

# For older versions:
#   Old DB plotter version
# devtools::install_github("dtm2451/dittoSeq@v0.2")
#   Old DB plotter version plus some early ditto plotters
# devtools::install_github("dtm2451/dittoSeq@v0.2.20")

News: version 0.3.0 is LIVE

Includes lots of new features!

Other updates since version 0.2:

More detailed vignettes are planned, but in the meantime, if the in-R documentation (example: ?dittoScatterPlot) and examples are not enough, please create an issue asking how to make whatever plot you would like!

Color blindness friendliness:

The default colors of this package are meant to be color blind friendly. To make it so, I used the suggested colors from this source: Wong B, “Points of view: Color blindness.” Nature Methods, 2011 and adapted them slightly by appending darker and lighter versions to create a 24 color vector. All plotting functions use these colors, stored in dittoColors(), by default. Also included is a Simulate() function that allows you to see what your function might look like to a colorblind individual. For more info on that, see my Colorblindness Compatibility Page

Quick Start Guide:

(For rendered plots, download and open Vignette/QuickStartRender.html)

# Install
devtools::install_github("dtm2451/dittoSeq@Development-v0.3.0")
## Skipping install of 'dittoSeq' from a github remote, the SHA1 (94a3666e) has not changed since last install.
##   Use `force = TRUE` to force installation
# (Be sure to restart after a re-install!)

Load in your data, then go!:

library(dittoSeq)
## Loading required package: ggplot2
# library(Seurat)

# For working with scRNAseq data, works directly with Seurat and SingleCellExperiment objects
seurat <- Seurat::pbmc_small
## Registered S3 method overwritten by 'R.oo':
##   method        from       
##   throw.default R.methodsS3
dittoPlot("CD14", seurat, group.by = "ident")

sce <- Seurat::as.SingleCellExperiment(seurat)
dittoBarPlot("ident", sce, group.by = "RNA_snn_res.0.8")

# For working with bulk RNAseq data, first load your data into a format that dittoSeq quickly understands
# deseq2 <- importDESeq2()
# edger <- importEdgeR()
# limma.voom <- importEdgeR()
myRNA <- RNAseq_mock
dittoDimPlot("Gene1", myRNA, size = 3)

Quickly determine the metadata and gene options for plotting with helper functions:

get.metas(seurat)
## [1] "orig.ident"      "nCount_RNA"      "nFeature_RNA"    "RNA_snn_res.0.8"
## [5] "letter.idents"   "groups"          "RNA_snn_res.1"
is.meta("nCount_RNA", seurat)
## [1] TRUE
get.genes(myRNA)
##   [1] "Gene1"   "Gene2"   "Gene3"   "Gene4"   "Gene5"   "Gene6"   "Gene7"  
##   [8] "Gene8"   "Gene9"   "Gene10"  "Gene11"  "Gene12"  "Gene13"  "Gene14" 
##  [15] "Gene15"  "Gene16"  "Gene17"  "Gene18"  "Gene19"  "Gene20"  "Gene21" 
##  [22] "Gene22"  "Gene23"  "Gene24"  "Gene25"  "Gene26"  "Gene27"  "Gene28" 
##  [29] "Gene29"  "Gene30"  "Gene31"  "Gene32"  "Gene33"  "Gene34"  "Gene35" 
##  [36] "Gene36"  "Gene37"  "Gene38"  "Gene39"  "Gene40"  "Gene41"  "Gene42" 
##  [43] "Gene43"  "Gene44"  "Gene45"  "Gene46"  "Gene47"  "Gene48"  "Gene49" 
##  [50] "Gene50"  "Gene51"  "Gene52"  "Gene53"  "Gene54"  "Gene55"  "Gene56" 
##  [57] "Gene57"  "Gene58"  "Gene59"  "Gene60"  "Gene61"  "Gene62"  "Gene63" 
##  [64] "Gene64"  "Gene65"  "Gene66"  "Gene67"  "Gene68"  "Gene69"  "Gene70" 
##  [71] "Gene71"  "Gene72"  "Gene73"  "Gene74"  "Gene75"  "Gene76"  "Gene77" 
##  [78] "Gene78"  "Gene79"  "Gene80"  "Gene81"  "Gene82"  "Gene83"  "Gene84" 
##  [85] "Gene85"  "Gene86"  "Gene87"  "Gene88"  "Gene89"  "Gene90"  "Gene91" 
##  [92] "Gene92"  "Gene93"  "Gene94"  "Gene95"  "Gene96"  "Gene97"  "Gene98" 
##  [99] "Gene99"  "Gene100"
is.gene("CD3E", myRNA)
## [1] FALSE
# View them with these:
gene("CD3E", seurat, data.type = "raw")
## ATGCCAGAACGACT CATGGCCTGTGCAT GAACCTGATGAACC TGACTGGATTCTCA AGTCAGACTGCACA 
##              0              2              1              4              3 
## TCTGATACACGTGT TGGTATCTAAACAG GCAGCTCTGTTTCT GATATAACACGCAT AATGTTGACAGTCA 
##              1              3              4              2              0 
## AGGTCATGAGTGTC AGAGATGATCTCGC GGGTAACTCTAGTG CATGAGACACGGGA TACGCCACTCCGAA 
##              0              0              0              0              0 
## CTAAACCTGTGCAT GTAAGCACTCATTC TTGGTACTGAATCC CATCATACGGAGCA TACATCACGCTAAC 
##              0              0              1              1              1 
## TTACCATGAATCGC ATAGGAGAAACAGA GCGCACGACTTTAC ACTCGCACGAAAGT ATTACCTGCCTTAT 
##              1              0              0              0              0 
## CCCAACTGCAATCG AAATTCGAATCACG CCATCCGATTCGCC TCCACTCTGAGCTT CATCAGGATGCACA 
##              0              0              0              0              0 
## CTAAACCTCTGACA GATAGAGAAGGGTG CTAACGGAACCGAT AGATATACCCGTAA TACTCTGAATCGAC 
##              0              1              0              1              0 
## GCGCATCTTGCTCC GTTGACGATATCGG ACAGGTACTGGTGT GGCATATGCTTATC CATTACACCAACTG 
##              0              0              0              1              0 
## TAGGGACTGAACTC GCTCCATGAGAAGT TACAATGATGCTAG CTTCATGACCGAAT CTGCCAACAGGAGC 
##              1              0              2              0              1 
## TTGCATTGAGCTAC AAGCAAGAGCTTAG CGGCACGAACTCAG GGTGGAGATTACTC GGCCGATGTACTCT 
##              2              0              1              5              2 
## CGTAGCCTGTATGC TGAGCTGAATGCTG CCTATAACGAGACG ATAAGTTGGTACGT AAGCGACTTTGACG 
##              0              0              0              0              0 
## ACCAGTGAATACCG ATTGCACTTGCTTT CTAGGTGATGGTTG GCACTAGACCTTTA CATGCGCTAGTCAC 
##              0              0              0              0              0 
## TTGAGGACTACGCA ATACCACTCTAAGC CATATAGACTAAGC TTTAGCTGTACTCT GACATTCTCCACCT 
##              1              0              0              0              0 
## ACGTGATGCCATGA ATTGTAGATTCCCG GATAGAGATCACGA AATGCGTGGACGGA GCGTAAACACGGTT 
##              0              0              0              0              1 
## ATTCAGCTCATTGG GGCATATGGGGAGT ATCATCTGACACCA GTCATACTTCGCCT TTACGTACGTTCAG 
##              0              0              0              0              0 
## GAGTTGTGGTAGCT GACGCTCTCTCTCG AGTCTTACTTCGGA GGAACACTTCAGAC CTTGATTGATCTTC 
##              0              0              0              1              0
meta("groups", seurat)
##  [1] "g2" "g1" "g2" "g2" "g2" "g1" "g1" "g1" "g1" "g1" "g2" "g1" "g2" "g2"
## [15] "g2" "g1" "g2" "g1" "g1" "g2" "g1" "g1" "g2" "g2" "g1" "g2" "g2" "g2"
## [29] "g2" "g1" "g1" "g1" "g1" "g2" "g1" "g1" "g2" "g1" "g1" "g2" "g1" "g2"
## [43] "g2" "g2" "g1" "g2" "g1" "g2" "g1" "g2" "g1" "g2" "g2" "g2" "g1" "g1"
## [57] "g1" "g1" "g2" "g1" "g1" "g1" "g1" "g1" "g1" "g2" "g2" "g1" "g1" "g1"
## [71] "g2" "g1" "g2" "g2" "g1" "g1" "g2" "g1" "g2" "g1"
meta.levels("groups", seurat)
## [1] "g1" "g2"

There are many dittoSeq Plot Types

Intuitive default adjustments generally allow creation of immediately useable plots.

# dittoPlot
dittoPlot("CD3E", seurat, group.by = "ident")

dittoPlot("CD3E", seurat, group.by = "ident",
    plots = c("boxplot", "jitter"))

dittoPlot("CD3E", seurat, group.by = "ident",
    plots = c("ridgeplot", "jitter"))
## Picking joint bandwidth of 0.859

# dittoDimPlot
dittoDimPlot("ident", seurat, size = 3)

dittoDimPlot("CD3E", seurat, size = 3)

# dittoBarPlot
dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8")

dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8",
    scale = "count")

# dittoHeatmap
dittoHeatmap(genes = get.genes(seurat)[1:20], seurat)

dittoHeatmap(genes = get.genes(seurat)[1:20], seurat,
    annotation.metas = c("groups", "ident"),
    scaled.to.max = TRUE,
    show.colnames = FALSE)

# Turning off cell clustering can be necessary for many cell scRNAseq
dittoHeatmap(genes = get.genes(seurat)[1:20], seurat,
    cluster_cols = FALSE)

# dittoScatterPlot
dittoScatterPlot(
    x.var = "CD3E", y.var = "nCount_RNA",
    color.var = "ident", shape.var = "RNA_snn_res.0.8",
    object = seurat,
    size = 3)

# Also:
    # multi_dittoDimPlot (multiple, in an array)
    # multi_dittoDimPlotVaryCells (multiple, in an array, but showing only certain
    #     cells in each plot)
    # multi_dittoPlot (multiple, in an array)
    # dittoPlot_VarsAcrossGroups (multiple genes or metadata as the jitterpoints (and
    #     other representations), summarized across groups by mean, median, ..., )

Many adjustments can be made with simple additional inputs:

Many adjustments to how data is reresented are within the examples above. See documentation for more! Also,

  • All Titles are adjustable.
  • Colors can be adjusted easily.
  • Underlying data can be output.
  • plotly hovering can be added.
  • Many more! (Legends removal, label rotation, labels’ and groupings’ names, …)
dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8",
    main = "Starters",
    sub = "By Type",
    xlab = NULL,
    ylab = "Generation 1",
    x.labels = c("Ash", "Misty"),
    legend.title = "Types",
    var.labels.rename = c("Fire", "Water", "Grass"),
    x.labels.rotate = FALSE)

dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8",
    colors = c(3,1,2)) #Just changes the color order, probably most useful for dittoDimPlots

dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8",
    color.panel = c("red", "orange", "purple"))

dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8",
    data.out = TRUE)
##   label grouping count label.count.total    percent
## 1     0        0    35                53 0.66037736
## 2     1        0     1                53 0.01886792
## 3     2        0    17                53 0.32075472
## 4     0        1     1                27 0.03703704
## 5     1        1    24                27 0.88888889
## 6     2        1     2                27 0.07407407
dittoBarPlot("ident", seurat, group.by = "RNA_snn_res.0.8",
    do.hover = TRUE)
## Warning: Ignoring unknown aesthetics: text